#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
    int a, b;
    char c;
    scanf("%d %d %c", &a, &b, &c);
    double sum = 0;
    double z = 0.95;
    if (c == 'e')
        z = 0.97;
    switch (b) {
    case 90:
        sum = a * 6.95 * z;
        printf("%.2lf", sum);
        break;
    case 93:
        sum = a * 7.44 * z;
        printf("%.2lf", sum);
        break;
    case 97:
        sum = a * 7.93 * z;
        printf("%.2lf", sum);
        break;
    }
    return 0;
}